<?php

namespace App\Repositories\Transformers;

use App\Models\Activity;
use App\Models\ActivityForm;
use League\Fractal\TransformerAbstract;

class ActivityFormTransformer extends TransformerAbstract
{
    public function transform(ActivityForm $activityForm)
    {
        $activity = $activityForm->activity;

        if ($activity) {
            return [
                'id' => $activity->id,
                'title' => $activity->title,
                'image' => $activity->image,
                'activity_time_start' => $activity->activity_time_start,
                'activity_time_end' => $activity->activity_time_end,
                'address' => $activity->address,
                'cost' => $activity->cost,
                'audit_status' => $activityForm->audit_status,
            ];
        } else {
            return [];
        }
    }
}
